{% extends "stories/base_story.html" %}
{% load formfields i18n %}

{% block head_title %} Media for {{ story }}{% endblock %}

{% block extra_head %}
    {{ block.super }}
    <script type="text/javascript" src="{{ MEDIA_URL }}common/js/swfobject.js"></script>
{% endblock %}

{% block media_css %}active{% endblock %}

{% block tab_contents %}

    <div id="story-media" class="tab">
        {% for item in story.relatedcontent_set.all %}
        <div class="media-list-block {% cycle 'odd' 'even' %}" id="media-item-{{item.id}}">
            <p class="media-thumb" style="width: {{item.object.get_thumbnail_width}};">
            <a href="{% url multimedia_preview item.object.id %}?width={{ item.object.get_width_with_margin }}&height={{ item.object.get_height_with_margin }}" 
               class="thickbox"
               ><img src="{{item.object.get_thumbnail_url}}" /></a></p>

            <h2>{{ item.object }}</h2>
            <p>Type: {{ item.object.get_child_name }}</p>
            <p>Dimensions: {{ item.object.get_width }} x {{ item.object.get_height }}</p>
            <p>Status: {{ item.object.get_status_display }}</p>
            <p>Authors: {{ item.object.authors.all|join:', ' }}</p>
            <p>Attribution: {{item.object.attribution|truncatewords:30}}</p>
            <p>Summary: {{item.object.summary|truncatewords:20}}</p>
            {% if item.object.get_original_url %}
            <p><a href="{{ item.object.get_original_url }}">Original File</a></p>
            {% endif %}
            <p class="action-links rounded-block">
            <a href="{% url stories_story_edit_media story.id item.object.id %}">Edit</a> 
            <a class="delete" href="">Delete</a></p>

        </div>
        {% empty %}
        <div>You haven't uploaded any {{ media_type }} media yet.</div>
        {% endfor %}
    </div>

    <br class="clear" />

{% endblock %}
